<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class home extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
    
                public $URL;
                public function __construct() {
                    parent::__construct();
                    $this->URL = $this->uri->uri_to_assoc();
                }
	public function index()
	{
                    $this->main();
	}
        
                public function main(){
                        $data["data"] = $this->db->select("*")->from("activity_events")->order_by("act_start_date","DESC")->limit(15)->get();
                        //$this->load->view("site/head");
                        $this->load->view("site/main",$data);
                        //$this->load->view("site/footer");
                }
                
                public function viewactivity(){
                    if($this->URL["ID"] != ""){
                                $CI =& get_instance();
                                $this->load->model("activity_model");
                                $this->load->model("major_model");
                                $this->load->model("teacher_model");
                                $data["activity_datay"] = $this->activity_model->get_activity(mysql_escape_string($this->URL["ID"]));
                                $data["CI"] = $CI;
                                $data["act_id"] = mysql_escape_string($this->URL["ID"]);
                                $data["photo"] = $this->db->select("*")->from("activity_photos")->where("ref_act_id",$this->URL["ID"])->get();
                                $this->load->view("site/head");
                                $this->load->view("site/view_activity",$data);
                                $this->load->view("site/footer");
                    }
                }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */